package cn.hh.wechatkit.pojo.message.imp.event.ticket;

import cn.hh.wechatkit.pojo.message.imp.event.Wx_IEventMsg;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * Created this one by HMH on 2017/5/6.
 */

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Wx_TicketGetEventMsg extends Wx_IEventMsg {

    Logger logger = LoggerFactory.getLogger(Wx_TicketGetEventMsg.class);

    private String cardId;
    private String isGiveByFriend;
    private String UserCardCode;
    private String OldUserCardCode;
    private String OuterId;
    private String OuterStr;
    private String IsRestoreMemberCard;
    private String UnionId;

    public Wx_TicketGetEventMsg(Map<String, String> map) {
        super(map);
        cardId = map.getOrDefault("CardId","");
        isGiveByFriend = map.getOrDefault("IsGiveByFriend","");
        UserCardCode = map.getOrDefault("UserCardCode","");
        OldUserCardCode = map.getOrDefault("OldUserCardCode","");
        OuterId = map.getOrDefault("OuterId","");
        OuterStr = map.getOrDefault("OuterStr","");
        UnionId = map.getOrDefault("UnionID","");
        IsRestoreMemberCard = map.getOrDefault("IsRestoreMemberCard","");
    }

    //事件消息不需要回应
    @Override
    public String MsgToXml() {
        return "";
//        //生成xml文档
//        Document document = DocumentHelper.createDocument();
//        document.setXMLEncoding("utf-8");
//        Element root = document.addElement("xml");
//        //添加 ToUserName
//        Element ToUserName = root.addElement("ToUserName")
//                .addText(XmlUtil.genCdataAttr(this.getToUserName()));
//        //添加 FromUserName
//        Element FromUserName = root.addElement("FromUserName")
//                .addText(XmlUtil.genCdataAttr(this.getFromUserName()));
//        //添加 CreateTime
//        Element CreateTime = root.addElement("CreateTime")
//                .addText(XmlUtil.genCdataAttr(String.valueOf(this.getCreateTime())));
//        //添加 MsgType
//        Element MsgType = root.addElement("MsgType")
//                .addText(XmlUtil.genCdataAttr("event"));
//        //添加 event
//        Element event = root.addElement("event")
//                .addText(XmlUtil.genCdataAttr(this.event));
//        //添加 CardId
//        Element CardId = root.addElement("CardId")
//                .addText(XmlUtil.genCdataAttr(this.cardId));
//        //添加 IsGiveByFriend
//        Element IsGiveByFriend = root.addElement("IsGiveByFriend")
//                .addText(XmlUtil.genCdataAttr(this.isGiveByFriend));
//        //添加 UserCardCode
//        Element UserCardCode = root.addElement("UserCardCode")
//                .addText(XmlUtil.genCdataAttr(this.UserCardCode));
//        //添加 OldUserCardCode
//        Element OldUserCardCode = root.addElement("OldUserCardCode")
//                .addText(XmlUtil.genCdataAttr(this.OldUserCardCode));
//        //添加 OuterStr
//        Element OuterStr = root.addElement("OuterStr")
//                .addText(XmlUtil.genCdataAttr(this.OuterStr));
//        //添加 IsRestoreMemberCard
//        Element IsRestoreMemberCard = root.addElement("IsRestoreMemberCard")
//                .addText(XmlUtil.genCdataAttr(this.IsRestoreMemberCard));
//
//        return document.asXML();
    }
}
